//
//  ContentView.swift
//  NavigationDemo
//
//  Created by hongyan.yang on 2022/4/15.
//

import SwiftUI

struct FirstView: View {
    @EnvironmentObject var navigation: Navigation
    var body: some View {
        NavigationView{
            VStack{
                NavigationLink(destination: SecondView(), isActive: $navigation.secondViewShowing) {
                    Text("2nd view")
                }.navigationBarTitle("first view")
            }
        }.navigationViewStyle(StackNavigationViewStyle())
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        FirstView()
    }
}
